#ifndef GOOGLETILE_H
#define GOOGLETILE_H

#include "GeoDefination.h"
#include <QImage>
#include "httpgetter.h"

class GoogleTile : public QObject
{
    Q_OBJECT

public:
    GoogleTile(QObject *parent = 0);
    GoogleTile(int x, int y, int z);
    ~GoogleTile();
    static double GetResolutionByLevel(int level);

    int getMX() const;
    void setMX(int value);

    int getMY() const;
    void setMY(int value);

    int getMZ() const;
    void setMZ(int value);

    QImage *getMImage() const;
    void setMImage(QImage *value);

    GeoExtent getMGeoExtent() const;
    void setMGeoExtent(const GeoExtent &value);


signals:
    void finished(GoogleTile* tile);

public slots:
    void ImageDownloaded();

private:
    int mX;             ///<瓦片所在列号
    int mY;             ///<瓦片所在行号
    int mZ;             ///<瓦片所在层级
    GeoExtent mGeoExtent;       ///<瓦片的地理范围
    QImage* mImage;       ///<瓦片的影像的缓存
    double mResolution; ///<瓦片影像的空间分辨率
    HttpGetter httpGetter;
};

#endif // GOOGLETILE_H
